home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
3006
/
3006.xpi
/
chrome
/
dwhelper.jar
/
content
/
video-format.xul
< prev
next >
Wrap
Extensible Markup Language
|
2010-01-15
|
4KB
|
119 lines
<?xml version="1.0"?>
<!-- *****************************************************************************
* Copyright (c) 2006-2009 Michel Gutierrez. All Rights Reserved.
****************************************************************************** -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://dwhelper/skin/dwhelper.css" type="text/css"?>
<?xml-stylesheet href="chrome://dwhelper/content/bindings.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://dwhelper/locale/dwhelper.dtd" >
<dialog id="dwhelper-output-video-format"
title="&title.output-video-format;"
flex="1"
onload="onLoad()"
ondialogaccept="return doOk();"
ondialoghelp="return doHelp();"
buttons="help,accept,cancel"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
>
<popupset>
<popup id="videoformat-popup" onpopupshowing="onPopupShowing()">
<menuitem label="&menu.video-format.copy;" oncommand="copyFormat()"/>
<menuitem label="&menu.video-format.paste;" oncommand="pasteFormat()" id="paste-entry"/>
</popup>
</popupset>
<script type="application/x-javascript"
src="chrome://dwhelper/content/dwhutil.js" />
<script type="application/x-javascript">
<![CDATA[
function onLoad() {
var data=window.arguments[0];
data.ok=false;
this.document.getElementById("format");
document.getElementById("format").value=data.format;
}
function doOk() {
var data=window.arguments[0];
data.format=document.getElementById("format").value;
data.ok=true;
return true;
}
function copyFormat() {
var str = Components.classes["@mozilla.org/supports-string;1"].
createInstance(Components.interfaces.nsISupportsString);
if (!str) return;
var text=document.getElementById("format").value;
str.data = text;
var trans = Components.classes["@mozilla.org/widget/transferable;1"].
createInstance(Components.interfaces.nsITransferable);
if (!trans) return;
trans.addDataFlavor("text/unicode");
trans.setTransferData("text/unicode",str,text.length * 2);
var clipid = Components.interfaces.nsIClipboard;
var clip = Components.classes["@mozilla.org/widget/clipboard;1"].
getService(clipid);
if (!clip) return;
clip.setData(trans,null,clipid.kGlobalClipboard);
}
function pasteFormat() {
var format=getFormatFromClipboard();
if(format)
document.getElementById("format").value=format;
}
function getFormatFromClipboard() {
try {
var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(Components.interfaces.nsIClipboard);
if (!clip) return null;
var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
if (!trans) return null;
trans.addDataFlavor("text/unicode");
clip.getData(trans,clip.kGlobalClipboard);
var str = new Object();
var strLength = new Object();
trans.getTransferData("text/unicode",str,strLength);
str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
str = str.data.substring(0,strLength.value / 2);
if(/^\S+\/((\s*-\S+(\s+\S+)?)+){1,2}$/.test(str))
return str;
else
return null;
} catch(e) {
return null;
}
}
function onPopupShowing() {
var format=getFormatFromClipboard();
var pasteEntry=document.getElementById("paste-entry");
if(format)
pasteEntry.setAttribute("hidden","false");
else
pasteEntry.setAttribute("hidden","true");
}
function doHelp() {
window.opener.open("http://www.downloadhelper.net/conversion-manual.php#details");
return false;
}
]]>
</script>
<NamedVideoFormat id="format" context="videoformat-popup"/>
</dialog>